﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using static MCUPic.Core.DataBox;

namespace MCUPic.Core
{
    public class DataBox
    {
        byte[] content;
        public UInt16Index UInt16;

        public DataBox(object bytes)
        {
            content = (byte[])bytes;
            UInt16 = new UInt16Index(content);
        }


        public class UInt16Index
        {
            byte[] content;

            public UInt16Index(byte[] content)
            {
                this.content = content;
            }

            public UInt16 this[int index]
            {
                get
                {
                    return (UInt16)(content[index * 2] | (content[index * 2 + 1] << 8));
                }
                set
                {
                    content[index * 2] = (byte)(value & 0xFF);
                    content[index * 2 + 1] = (byte)(value >> 8);
                }
            }
        }
    }

}
